<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #input1 {
            width: 400px;
            height: 24px;
            margin-left: 100px;
        }

        div {
            width: 404px;
            height: 300px;
            margin-left: 100px;
            background: #eeeeee;
        }

        #content {
            display: none;
        }

    </style>
</head>
<body>
    <form action="" method="post">
        <input id="input1" onblur="changeName()" name="keyword" >
        <input type="submit" value="搜索">
        <div id="content"></div>
    </form>
</body>
<script src="webjars/jquery/3.6.1/jquery.js"></script>
<script>
    function changeName(){

        $.ajax({
            type: "get",
            url: "/autocomplete?name="+$("#input1").val(),
            dataType:"json",
            success: function(data){
                // 在这里处理后台返回的数据
                $("#content").html("");
                for (var i = 0; i < data.length; i++) {
                    var pTag = document.createElement('p')
                    pTag.innerText = data[i].university;
                    content.appendChild(pTag)
                }
                $("#content").show();
            }
        });

        $.getJSON()

        $("#input1").blur(function () {
            $("#content").hide();
        });
    }

</script>
</html>